fix(orchestrator): bug fix in pkg/nfsproxy/recovery#2606
Conversation
`pkg/nfsproxy/recovery` had a real defect that surfaced on every
platform but was masked because the package's tests were the only
thing exercising the panic path; on darwin the test harness ran but
still crashed with `panic: Mount [recovered, repanicked]`.
Bug fix in pkg/nfsproxy/recovery
`Handler.Mount`, `Change`, `ToHandle` and `HandleLimit` deferred a
*method* `h.tryRecovery(ctx, name)` whose body simply called the
package-level `tryRecovery(ctx, name)`. Because `recover()` only
returns non-nil when invoked directly inside the deferred function
frame, the indirection meant `recover()` always returned nil and
panics propagated out of `Handler.Mount` & friends — defeating the
whole point of the recovery wrapper.
`TestHandler_Mount_Panic_NoCrash` was written to assert exactly this
property and consequently failed on every platform.
Replaced the pass-through method with a direct
`defer tryRecovery(ctx, name)` call at every call site and removed
the now-redundant `(Handler).tryRecovery` method. Added a comment to
the package-level `tryRecovery` explaining why it must be called via
`defer` directly.
There was a problem hiding this comment.
Code review is billed via overage credits. To resume reviews, an organization admin can raise the monthly limit at claude.ai/admin-settings/claude-code.
Once credits are available, reopen this pull request to trigger a review.
❌ 9 Tests Failed:
View the full list of 9 ❄️ flaky test(s)
To view more test analytics, go to the Test Analytics Dashboard |
pkg/nfsproxy/recoveryhad a real defect that surfaced on everyplatform but was masked because the package's tests were the only
thing exercising the panic path; on darwin the test harness ran but
still crashed with
panic: Mount [recovered, repanicked].Bug fix in pkg/nfsproxy/recovery
Handler.Mount,Change,ToHandleandHandleLimitdeferred amethod
h.tryRecovery(ctx, name)whose body simply called thepackage-level
tryRecovery(ctx, name). Becauserecover()onlyreturns non-nil when invoked directly inside the deferred function
frame, the indirection meant
recover()always returned nil andpanics propagated out of
Handler.Mount& friends — defeating thewhole point of the recovery wrapper.
TestHandler_Mount_Panic_NoCrashwas written to assert exactly thisproperty and consequently failed on every platform.
Replaced the pass-through method with a direct
defer tryRecovery(ctx, name)call at every call site and removedthe now-redundant
(Handler).tryRecoverymethod. Added a comment tothe package-level
tryRecoveryexplaining why it must be called viadeferdirectly.